package com.duck.api.client;

import com.duck.api.dto.ItemDTO;
import com.duck.api.dto.OrderDetailDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;


@FeignClient("item-service")//调用的服务的名字，以获取实例列表
public interface ItemClient {
    @GetMapping("/items")//声明请求路径以及请求方法
    //返回值+方法名+参数
    List<ItemDTO> queryItemByIds(@RequestParam("ids") Collection<Long> ids);

    @PutMapping("/items/stock/deduct")
    void deductStock(@RequestBody List <OrderDetailDTO> items);
}
